#ifndef __TCPCONNECTION_H__
#define __TCPCONNECTION_H__

#include "Socket.hpp"
#include "SocketIO.hpp"
#include "InetAddress.hpp"

namespace wd
{

class TcpConnection
{

public:
    TcpConnection(int fd);

    string receive();
    
    void send(const string & msg);

    bool isClosed() const;

    void shutdown();

    string toString() const;

private:
    InetAddress getLocalAddress();
    InetAddress getPeerAddress();

private:
    Socket _sock;
    SocketIO _sockIO;
    InetAddress _localAddr;
    InetAddress _peerAddr;
};

} // end of namespace wd

#endif

